# namedTuple
from collections import namedtuple
from recordclass import recordclass

# 基金表项
# @recordclass
# class FundItem:
#     trading_data: str
#     symbol: int
#     open_price: float
#     close_price: float
#     high_price: float
#     low_price: float
#     volume:int
#     amount:float
#     avg_price:float
#     change:float
#     turnover_rate:float
#     market_value:float
#     comparable_price:float
#     simple_comparable_price:float

FundItem = recordclass('FundItem',
                       ['trading_date', 'symbol', 'open_price', 'close_price', 'high_price', 'low_price', 'volume',
                        'amount', 'avg_price', 'change', 'turnover_rate', 'market_value', 'comparable_price',
                        'simple_comparable_price'])
'''

create table fund_maininfo
(
    MasterFundCode  int  null,
    FullName        text null,
    InceptionDate   text null,
    FundCompanyID   int  null,
    FundCompanyName text null,
    CustodianID     int  null,
    InvestmentGoal  text null,
    InvestmentScope text null,
    RiskDescription text null,
    FundType        text null,
    Category        text null,
    InvestmentStyle text null,
    ShortFinancing  int  null
);'''

FundMainInfo = recordclass('FundMainInfo',
                           ['master_fund_code', 'full_name', 'inception_date', 'fund_company_id', 'fund_company_name',
                            'custodian_id', 'investment_goal', 'investment_scope', 'risk_description', 'fund_type',
                            'category', 'investment_style', 'short_financing'])


#FundItem管理项
class FundItemManager:
    def __init__(self, symbol):
        self.symbol = symbol
        self.fund_items = []

    def sharp_ratio(self):
        pass
